package cn.sunlelin.educationserver.service.Impl;

import cn.sunlelin.educationserver.entity.Poster;
import cn.sunlelin.educationserver.mapper.PosterMapper;
import cn.sunlelin.educationserver.service.PosterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class PosterServiceImpl implements PosterService {
    @Autowired
    private PosterMapper posterMapper;
    @Override
    public Boolean createPoster(Poster poster) {
        poster.setCreateTime(new Date());
        posterMapper.createPoster(poster);
        return true;
    }

    @Override
    public Boolean updatePoster(Poster poster) {
        poster.setUpdateTime(new Date());
        posterMapper.updatePoster(poster);
        return true;
    }

    @Override
    public List<Poster> selectPosterAll() {
        return posterMapper.selectPosterAll();
    }

    @Override
    public Boolean deletePost(Integer posterId) {
        Poster poster=new Poster();
        poster.setPosterId(posterId);
        poster.setUpdateTime(new Date());
        posterMapper.deletePost(poster);
        return true;
    }
}
